package cn.com.cym.gamezao.quartz;

import cn.com.cym.gamezao.service.SmsService;
import cn.com.cym.gamezao.service.xmu.ScheduleService;
import cn.hutool.extra.spring.SpringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 课程表功能提醒
 */
@Component
public class ScheduleJob{

    private static ScheduleService scheduleService;
    static {
        scheduleService = SpringUtil.getBean(ScheduleService.class);
    }



    private static final Logger log = LoggerFactory.getLogger(ScheduleJob.class);

    private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");

    /**
     * 每天10点，15点，18点执行
     */
    @Scheduled(cron = "0 0 10,15,18 * * ?")
    public void reportCurrentTime() {
        log.info("The time is now {}", dateFormat.format(new Date()));
        Boolean success = this.scheduleService.sendMessage();// 实现发布任务的业务接口
    }

   /* @Scheduled(fixedRate = 5000)
    public void doTest() {
        log.info("The time is now {}", dateFormat.format(new Date()));
        Boolean success = this.scheduleService.sendMessage();
    }*/
}
